/**
 * @Author：zy
 * @Description：模拟React.createElement方法  用于创建虚拟DOM节点
 * @Data: 2020/10/10 15:07
 */
function createElement(type,props,...children){
    console.log(arguments);
    props.children = children;


    //通过vtype区分3中组件  1：html元素  2：class组件  3:函数组件
    let vtype ;
    if(typeof type === 'function'){
        if(type.isReactComponent){
            vtype = 2;
        }else{
            vtype = 3;
        }
    }else if(typeof type === 'string'){
        vtype = 1;
    }

    return {vtype,type,props};
}


export class Component{
    //标识符、区分class组件还是函数组件
    static isReactComponent = true;

    constructor(props){
        this.props = props;
        this.state = {};
    }

    setState(){

    }
}


export default {createElement};